// 云函数入口文件
const cloud = require('wx-server-sdk')
const md5 =require("md5");

process.env.TZ ='Asia/Shanghai'
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})
// 云函数入口函数

const db = cloud.database()
const _ = db.command

exports.main = async (event, context) => {
  console.log(event);

  const wxContext = cloud.getWXContext()


  let _openid = wxContext.OPENID;

  try{
    let _id = md5(_openid);
    return await db.collection('users').doc(_id).get();

  }catch(err){

  }
  
  


}